package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SoilChemistryMapper;
import com.ruoyi.system.domain.SoilChemistry;
import com.ruoyi.system.service.ISoilChemistryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 营养元素Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-20
 */
@Service
public class SoilChemistryServiceImpl implements ISoilChemistryService 
{
    @Autowired
    private SoilChemistryMapper soilChemistryMapper;

    /**
     * 查询营养元素
     * 
     * @param id 营养元素主键
     * @return 营养元素
     */
    @Override
    public SoilChemistry selectSoilChemistryById(Long id)
    {
        return soilChemistryMapper.selectSoilChemistryById(id);
    }

    /**
     * 查询营养元素列表
     * 
     * @param soilChemistry 营养元素
     * @return 营养元素
     */
    @Override
    public List<SoilChemistry> selectSoilChemistryList(SoilChemistry soilChemistry)
    {
        return soilChemistryMapper.selectSoilChemistryList(soilChemistry);
    }

    /**
     * 新增营养元素
     * 
     * @param soilChemistry 营养元素
     * @return 结果
     */
    @Override
    public int insertSoilChemistry(SoilChemistry soilChemistry)
    {
        soilChemistry.setCreateTime(DateUtils.getNowDate());
        return soilChemistryMapper.insertSoilChemistry(soilChemistry);
    }

    /**
     * 修改营养元素
     * 
     * @param soilChemistry 营养元素
     * @return 结果
     */
    @Override
    public int updateSoilChemistry(SoilChemistry soilChemistry)
    {
        soilChemistry.setUpdateTime(DateUtils.getNowDate());
        return soilChemistryMapper.updateSoilChemistry(soilChemistry);
    }

    /**
     * 批量删除营养元素
     * 
     * @param ids 需要删除的营养元素主键
     * @return 结果
     */
    @Override
    public int deleteSoilChemistryByIds(String ids)
    {
        return soilChemistryMapper.deleteSoilChemistryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除营养元素信息
     * 
     * @param id 营养元素主键
     * @return 结果
     */
    @Override
    public int deleteSoilChemistryById(Long id)
    {
        return soilChemistryMapper.deleteSoilChemistryById(id);
    }
}
